package com.tbit.uqbike.webmanager.controller;

import com.tbit.uqbike.object.pojo.AppointMentLog;
import com.tbit.uqbike.object.view.JsonResult;
import com.tbit.uqbike.service.business.AppointMentLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: chen
 * @Description: 预约日志
 * @Date: 创建于 17:41 2020/8/13
 */
@RestController
@RequestMapping("/appointMentLog")
public class AppointMentLogController {
    @Autowired
    private AppointMentLogService appointMentLogService;

    /**
     * 分页查询
     *
     * @param phone     手机号码
     * @param areaId    区域id
     * @param machineNO 设备编号
     * @param userCode  车辆编号
     * @param pageNO
     * @param rowCount
     * @return
     */

    @RequestMapping("/queryPage")
    public JsonResult queryPage(String phone, Integer areaId, String machineNO, String userCode,
                                @RequestParam(defaultValue = "10") Integer rowCount,
                                @RequestParam(defaultValue = "1") Integer pageNO) {
        List<AppointMentLog> appointMentLogs = appointMentLogService.queryPage(phone, areaId, machineNO, userCode, pageNO, rowCount);
        Integer total = appointMentLogService.queryCount(phone, areaId, machineNO, userCode);
        return JsonResult.ok(appointMentLogs, total);
    }
}
